<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- 引入 jquery -->
<script src="https://code.jquery.com/jquery.js"></script><!-- 导入JQuery方便使用ajax插件 -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet"><!-- 导入bootstrap -->

<script src="https://cdn.staticfile.org/twitter-bootstrap/3.3.7/js/bootstrap.min.js"></script><!-- 导入bootstrap核心js文件 -->
<!-- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> -->
<title>Insert title here</title>
</head>
<body>
<h1 style="margin-left: 50px;">我的订单</h1>

<div class="container mt-3">        
  <table class="table table-striped table-hover table-responsive-sm" style="width:1000px">
    <thead class="table-success">
      <tr>
        <th>订单编号</th>
        <th>下单时间</th>
        <th>订单状态</th>
        <th>收货地址</th>
        <th>收货人</th>
        <th>收货人电话</th>
        <th>订单详情</th>
        <th>备注</th>
      </tr>
    </thead>
    <tbody>
    <c:forEach var="o" items="${orders}">
      <tr>
        <td>${o.order_id}</td>
        <td>${o.order_time}</td>
        <td>${o.order_state}</td>
        <td>${o.order_add}</td>
        <td>${o.username}</td>
        <td>${o.tel}</td>
        <td><button  onclick="sub(${o.order_id})" class="btn btn-default" >订单详情</button></td>
        <td><a  href="/ProfessionalDesign/userorderdelete?order_id=${o.order_id}&user_id=${o.user_id}" class="btn btn-danger" >取消订单</a></td>
      </tr>
      </c:forEach>
    </tbody>
  </table>
</div>
</body>
<script>
function sub(data){
	console.log(data);
	//var order_id=parseInt(data);
	$('#main').load('/ProfessionalDesign/orderdetail?order_id='+data);
}
function dateToStr(date) {
    var time = new Date(date.time);
    var y = time.getFullYear();
    var M = time.getMonth() + 1;
    M = M < 10 ? ("0" + M) : M;
    var d = time.getDate();
    d = d < 10 ? ("0" + d) : d;
    var h = time.getHours();
    h = h < 10 ? ("0" + h) : h;
    var m = time.getMinutes();
    m = m < 10 ? ("0" + m) : m;
    var str = y + "-" + M + "-" + d+" "+h+":"+m;
    return str;
}
</script>
</html>